package com.ids.idtma.setting;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import org.apache.http.util.EncodingUtils;

import com.ids.idtma.ActivityBase;
import com.ids.idtma.IdtApplication;
import com.ids.idtma.R;
import com.ids.idtma.SystemSetting;
import com.ids.idtma.map.IdtMap;
import com.ids.proxy.IDSApiProxy;
import com.ids.proxy.IDSApiProxyMgr;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Switch;
import android.widget.TextView;

public class YuYinSettingActivity extends ActivityBase implements OnClickListener{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_yu_yin_setting);
		IdtApplication.getInstance().addActivity(this);
		String code = getIntent().getStringExtra("AUDIO_CODE");
		String pkgtime = getIntent().getStringExtra("AUDIO_PKGTIME");
		TextView audio_code = (TextView) findViewById(R.id.AUDIO_CODE);
		TextView audio_pkgtime = (TextView) findViewById(R.id.AUDIO_PKGTIME);
		((TextView) findViewById(R.id.page_title_name)).setText("语音配置");
		audio_code.setText(code);
		audio_pkgtime.setText(pkgtime);
		audio_pkgtime.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		Intent intent = new Intent();
		switch (v.getId()) {
		case R.id.return_button:// 返回按钮
			IdtApplication.getInstance().deleteActivity(this);
			break;
		case R.id.map:
			// 点击地图图标
			intent.setClass(YuYinSettingActivity.this, IdtMap.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(intent);
			break;
		case R.id.AUDIO_PKGTIME:
			File  file = new File(getFilesDir() + "/IDT.ini"); //data下文件的绝对路径
			try {
				FileInputStream fis = new FileInputStream(file);
				int len = fis.available();
				byte []buffer = new byte[len];
				fis.read(buffer);
				String resut = EncodingUtils.getString(buffer, "gbk");
				
				
				fis.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
			
			break;
		default:
			break;
		}
	}
}
